package 点名器;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;

public class CallNameDemo {
    public static void main(String[] args) throws IOException {
        //创建字符输入流对象
        BufferedReader br=new BufferedReader(new FileReader("test.txt"));
        ArrayList<String>array=new ArrayList<String>();
        String line;
        while((line=br.readLine())!=null){
            array.add(line);
        }
        br.close();

        Random rad=new Random();
        int index = rad.nextInt(array.size());

        String s = array.get(index);
        System.out.println("幸运者是"+s);
    }
}
